+Sun Aug 5 11:24:27 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkcolorsel.c (gtk_color_selection_set_current_alpha):
+ Fix conversion from float to int so that we don't get
+ skew in the int => float => int roundtrip.
+ (#58120, reported by Vitaly Tishkov). Also fix problem
+ where if no alpha was set, the returned alpha
+ from (say) set_current_alpha() was returned as 1, not 65535.
+
+Sun Aug 5 09:48:08 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtklist.c (gtk_list_clear_items): Fix
+ problem with selecting a new focus child.
+
+ * gtk/gtklist.c (gtk_list_clear_items): Clear
+ list->undo/list_focus_child after unparenting
+ child, since unparenting the child can result
+ in list->last_focus_child being set. (#58024)
+
+ * Makefile.am (SUBDIRS): Add target specific pc
+ files to DISTCLEANFILES.
+
+ * gtk/Makefile.am: add @GTK_DEBUG_FLAGS@
+ (58327, Matthias Clasen)
+
Sat Aug 4 19:28:21 2001 Owen Taylor <otaylor@redhat.com>
* tests/testgtk.c: Patch from Hans (with various modifications),
+Sun Aug 5 11:24:27 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkcolorsel.c (gtk_color_selection_set_current_alpha):
+ Fix conversion from float to int so that we don't get
+ skew in the int => float => int roundtrip.
+ (#58120, reported by Vitaly Tishkov). Also fix problem
+ where if no alpha was set, the returned alpha
+ from (say) set_current_alpha() was returned as 1, not 65535.
+
+Sun Aug 5 09:48:08 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtklist.c (gtk_list_clear_items): Fix
+ problem with selecting a new focus child.
+
+ * gtk/gtklist.c (gtk_list_clear_items): Clear
+ list->undo/list_focus_child after unparenting
+ child, since unparenting the child can result
+ in list->last_focus_child being set. (#58024)
+
+ * Makefile.am (SUBDIRS): Add target specific pc
+ files to DISTCLEANFILES.
+
+ * gtk/Makefile.am: add @GTK_DEBUG_FLAGS@
+ (58327, Matthias Clasen)
+
Sat Aug 4 19:28:21 2001 Owen Taylor <otaylor@redhat.com>
* tests/testgtk.c: Patch from Hans (with various modifications),
+Sun Aug 5 11:24:27 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkcolorsel.c (gtk_color_selection_set_current_alpha):
+ Fix conversion from float to int so that we don't get
+ skew in the int => float => int roundtrip.
+ (#58120, reported by Vitaly Tishkov). Also fix problem
+ where if no alpha was set, the returned alpha
+ from (say) set_current_alpha() was returned as 1, not 65535.
+
+Sun Aug 5 09:48:08 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtklist.c (gtk_list_clear_items): Fix
+ problem with selecting a new focus child.
+
+ * gtk/gtklist.c (gtk_list_clear_items): Clear
+ list->undo/list_focus_child after unparenting
+ child, since unparenting the child can result
+ in list->last_focus_child being set. (#58024)
+
+ * Makefile.am (SUBDIRS): Add target specific pc
+ files to DISTCLEANFILES.
+
+ * gtk/Makefile.am: add @GTK_DEBUG_FLAGS@
+ (58327, Matthias Clasen)
+
Sat Aug 4 19:28:21 2001 Owen Taylor <otaylor@redhat.com>
* tests/testgtk.c: Patch from Hans (with various modifications),
+Sun Aug 5 11:24:27 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkcolorsel.c (gtk_color_selection_set_current_alpha):
+ Fix conversion from float to int so that we don't get
+ skew in the int => float => int roundtrip.
+ (#58120, reported by Vitaly Tishkov). Also fix problem
+ where if no alpha was set, the returned alpha
+ from (say) set_current_alpha() was returned as 1, not 65535.
+
+Sun Aug 5 09:48:08 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtklist.c (gtk_list_clear_items): Fix
+ problem with selecting a new focus child.
+
+ * gtk/gtklist.c (gtk_list_clear_items): Clear
+ list->undo/list_focus_child after unparenting
+ child, since unparenting the child can result
+ in list->last_focus_child being set. (#58024)
+
+ * Makefile.am (SUBDIRS): Add target specific pc
+ files to DISTCLEANFILES.
+
+ * gtk/Makefile.am: add @GTK_DEBUG_FLAGS@
+ (58327, Matthias Clasen)
+
Sat Aug 4 19:28:21 2001 Owen Taylor <otaylor@redhat.com>
* tests/testgtk.c: Patch from Hans (with various modifications),
+Sun Aug 5 11:24:27 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkcolorsel.c (gtk_color_selection_set_current_alpha):
+ Fix conversion from float to int so that we don't get
+ skew in the int => float => int roundtrip.
+ (#58120, reported by Vitaly Tishkov). Also fix problem
+ where if no alpha was set, the returned alpha
+ from (say) set_current_alpha() was returned as 1, not 65535.
+
+Sun Aug 5 09:48:08 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtklist.c (gtk_list_clear_items): Fix
+ problem with selecting a new focus child.
+
+ * gtk/gtklist.c (gtk_list_clear_items): Clear
+ list->undo/list_focus_child after unparenting
+ child, since unparenting the child can result
+ in list->last_focus_child being set. (#58024)
+
+ * Makefile.am (SUBDIRS): Add target specific pc
+ files to DISTCLEANFILES.
+
+ * gtk/Makefile.am: add @GTK_DEBUG_FLAGS@
+ (58327, Matthias Clasen)
+
Sat Aug 4 19:28:21 2001 Owen Taylor <otaylor@redhat.com>
* tests/testgtk.c: Patch from Hans (with various modifications),
+Sun Aug 5 11:24:27 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkcolorsel.c (gtk_color_selection_set_current_alpha):
+ Fix conversion from float to int so that we don't get
+ skew in the int => float => int roundtrip.
+ (#58120, reported by Vitaly Tishkov). Also fix problem
+ where if no alpha was set, the returned alpha
+ from (say) set_current_alpha() was returned as 1, not 65535.
+
+Sun Aug 5 09:48:08 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtklist.c (gtk_list_clear_items): Fix
+ problem with selecting a new focus child.
+
+ * gtk/gtklist.c (gtk_list_clear_items): Clear
+ list->undo/list_focus_child after unparenting
+ child, since unparenting the child can result
+ in list->last_focus_child being set. (#58024)
+
+ * Makefile.am (SUBDIRS): Add target specific pc
+ files to DISTCLEANFILES.
+
+ * gtk/Makefile.am: add @GTK_DEBUG_FLAGS@
+ (58327, Matthias Clasen)
+
Sat Aug 4 19:28:21 2001 Owen Taylor <otaylor@redhat.com>
* tests/testgtk.c: Patch from Hans (with various modifications),
+Sun Aug 5 11:24:27 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkcolorsel.c (gtk_color_selection_set_current_alpha):
+ Fix conversion from float to int so that we don't get
+ skew in the int => float => int roundtrip.
+ (#58120, reported by Vitaly Tishkov). Also fix problem
+ where if no alpha was set, the returned alpha
+ from (say) set_current_alpha() was returned as 1, not 65535.
+
+Sun Aug 5 09:48:08 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtklist.c (gtk_list_clear_items): Fix
+ problem with selecting a new focus child.
+
+ * gtk/gtklist.c (gtk_list_clear_items): Clear
+ list->undo/list_focus_child after unparenting
+ child, since unparenting the child can result
+ in list->last_focus_child being set. (#58024)
+
+ * Makefile.am (SUBDIRS): Add target specific pc
+ files to DISTCLEANFILES.
+
+ * gtk/Makefile.am: add @GTK_DEBUG_FLAGS@
+ (58327, Matthias Clasen)
+
Sat Aug 4 19:28:21 2001 Owen Taylor <otaylor@redhat.com>
* tests/testgtk.c: Patch from Hans (with various modifications),
#define GTK_CUSTOM_PALETTE_WIDTH 10
#define GTK_CUSTOM_PALETTE_HEIGHT 2
+/* Conversion between 0->1 double and and guint16. See
+ * scale_round() below for more general conversions
+ */
+#define SCALE(i) (i / 65535.)
+#define UNSCALE(d) ((guint16)(d * 65535 + 0.5))
+
+
enum {
COLOR_CHANGED,
LAST_SIGNAL
{
da = priv->old_sample;
for (n = 0, i = COLORSEL_RED; n < 3; n++, i++)
- c[n] = (guchar) (255.0 * priv->old_color[i]);
+ c[n] = (guchar) (UNSCALE (priv->old_color[i]) >> 8);
goff = 0;
}
else
{
da = priv->cur_sample;
for (n = 0, i = COLORSEL_RED; n < 3; n++, i++)
- c[n] = (guchar) (255.0 * priv->color[i]);
+ c[n] = (guchar) (UNSCALE (priv->color[i]) >> 8);
goff = priv->old_sample->allocation.width % 32;
}
priv = colorsel->private_data;
- gdk_color.red = color[0]*65535;
- gdk_color.green = color[1]*65535;
- gdk_color.blue = color[2]*65535;
+ gdk_color.red = UNSCALE (color[0]);
+ gdk_color.green = UNSCALE (color[1]);
+ gdk_color.blue = UNSCALE (color[2]);
x = 0;
while (x < GTK_CUSTOM_PALETTE_WIDTH)
gdouble *old_color;
GdkColor gdk_color;
- gdk_color.red = color[0]*65535;
- gdk_color.green = color[1]*65535;
- gdk_color.blue = color[2]*65535;
+ gdk_color.red = UNSCALE (color[0]);
+ gdk_color.green = UNSCALE (color[1]);
+ gdk_color.blue = UNSCALE (color[2]);
gtk_widget_modify_bg (drawing_area, GTK_STATE_NORMAL, &gdk_color);
gdk_colormap_query_color (colormap, pixel, &color);
- priv->color[COLORSEL_RED] = (double)color.red / 65535.0;
- priv->color[COLORSEL_GREEN] = (double)color.green / 65535.0;
- priv->color[COLORSEL_BLUE] = (double)color.blue / 65535.0;
+ priv->color[COLORSEL_RED] = SCALE (color.red);
+ priv->color[COLORSEL_GREEN] = SCALE (color.green);
+ priv->color[COLORSEL_BLUE] = SCALE (color.blue);
gtk_rgb_to_hsv (priv->color[COLORSEL_RED],
priv->color[COLORSEL_GREEN],
(GTK_RANGE (priv->opacity_slider)),
scale_round (priv->color[COLORSEL_OPACITY], 255));
- g_snprintf (opacity_text, 32, "%.0f", priv->color[COLORSEL_OPACITY] * 255);
+ g_snprintf (opacity_text, 32, "%.0f", scale_round (priv->color[COLORSEL_OPACITY], 255));
gtk_entry_set_text (GTK_ENTRY (priv->opacity_entry), opacity_text);
g_snprintf (entryval, 11, "#%2X%2X%2X",
priv = colorsel->private_data;
priv->changing = TRUE;
- priv->color[COLORSEL_RED] = color->red / 65535.0;
- priv->color[COLORSEL_GREEN] = color->green / 65535.0;
- priv->color[COLORSEL_BLUE] = color->blue / 65535.0;
+ priv->color[COLORSEL_RED] = SCALE (color->red);
+ priv->color[COLORSEL_GREEN] = SCALE (color->green);
+ priv->color[COLORSEL_BLUE] = SCALE (color->blue);
gtk_rgb_to_hsv (priv->color[COLORSEL_RED],
priv->color[COLORSEL_GREEN],
priv->color[COLORSEL_BLUE],
priv = colorsel->private_data;
priv->changing = TRUE;
- priv->color[COLORSEL_OPACITY] = alpha / 65535.0;
+ priv->color[COLORSEL_OPACITY] = SCALE (alpha);
if (priv->default_alpha_set == FALSE)
{
for (i = 0; i < COLORSEL_NUM_CHANNELS; i++)
g_return_if_fail (GTK_IS_COLOR_SELECTION (colorsel));
priv = colorsel->private_data;
- color->red = priv->color[COLORSEL_RED] * 65535;
- color->green = priv->color[COLORSEL_GREEN] * 65535;
- color->blue = priv->color[COLORSEL_BLUE] * 65535;
+ color->red = UNSCALE (priv->color[COLORSEL_RED]);
+ color->green = UNSCALE (priv->color[COLORSEL_GREEN]);
+ color->blue = UNSCALE (priv->color[COLORSEL_BLUE]);
}
/**
g_return_val_if_fail (GTK_IS_COLOR_SELECTION (colorsel), 0);
priv = colorsel->private_data;
- return priv->has_opacity ? priv->color[COLORSEL_OPACITY] * 65535 : 1.0;
+ return priv->has_opacity ? UNSCALE (priv->color[COLORSEL_OPACITY]) : 65535;
}
/**
color[0] = priv->color[COLORSEL_RED];
color[1] = priv->color[COLORSEL_GREEN];
color[2] = priv->color[COLORSEL_BLUE];
- color[3] = priv->has_opacity ? priv->color[COLORSEL_OPACITY] : 1.0;
+ color[3] = priv->has_opacity ? priv->color[COLORSEL_OPACITY] : 65535;
}
/**
priv = colorsel->private_data;
priv->changing = TRUE;
- priv->old_color[COLORSEL_RED] = color->red / 65535.0;
- priv->old_color[COLORSEL_GREEN] = color->green / 65535.0;
- priv->old_color[COLORSEL_BLUE] = color->blue / 65535.0;
+ priv->old_color[COLORSEL_RED] = SCALE (color->red);
+ priv->old_color[COLORSEL_GREEN] = SCALE (color->green);
+ priv->old_color[COLORSEL_BLUE] = SCALE (color->blue);
gtk_rgb_to_hsv (priv->old_color[COLORSEL_RED],
priv->old_color[COLORSEL_GREEN],
priv->old_color[COLORSEL_BLUE],
priv = colorsel->private_data;
priv->changing = TRUE;
- priv->old_color[COLORSEL_OPACITY] = alpha / 65535.0;
+ priv->old_color[COLORSEL_OPACITY] = SCALE (alpha);
color_sample_draw_samples (colorsel);
priv->default_alpha_set = TRUE;
}
g_return_if_fail (GTK_IS_COLOR_SELECTION (colorsel));
priv = colorsel->private_data;
- color->red = priv->old_color[COLORSEL_RED] * 65535;
- color->green = priv->old_color[COLORSEL_GREEN] * 65535;
- color->blue = priv->old_color[COLORSEL_BLUE] * 65535;
+ color->red = UNSCALE (priv->old_color[COLORSEL_RED]);
+ color->green = UNSCALE (priv->old_color[COLORSEL_GREEN]);
+ color->blue = UNSCALE (priv->old_color[COLORSEL_BLUE]);
}
/**
g_return_val_if_fail (GTK_IS_COLOR_SELECTION (colorsel), 0);
priv = colorsel->private_data;
- return priv->has_opacity ? priv->old_color[COLORSEL_OPACITY] * 65535 : 1.0;
+ return priv->has_opacity ? UNSCALE (priv->old_color[COLORSEL_OPACITY]) : 65535;
}
/**
y = index / GTK_CUSTOM_PALETTE_WIDTH;
priv = colorsel->private_data;
- col[0] = color->red / 65535.0;
- col[1] = color->green / 65535.0;
- col[2] = color->blue / 65535.0;
+ col[0] = SCALE (color->red);
+ col[1] = SCALE (color->green);
+ col[2] = SCALE (color->blue);
palette_set_color (priv->custom_palette[x][y], colorsel, col);
}
palette_get_color (priv->custom_palette[x][y], col);
- color->red = col[0] * 65535;
- color->green = col[1] * 65535;
- color->blue = col[2] * 65535;
+ color->red = UNSCALE (col[0]);
+ color->green = UNSCALE (col[1]);
+ color->blue = UNSCALE (col[2]);
return TRUE;
}